<?
 	require_once('../fun/vocab.php');
 	$results = array();
		if(isset($_POST['id'])) {
			$row = $_POST;
		$results = ValidateWord($row);
			if($results === true)
		$results = SaveWord($row);
			if($results === TRUE) {
				header("Location: index.php");
				die();
			}}else{
		$row = GetWord($_REQUEST['id']);
 	}
 ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>&psi; db: Edit Information for <?=$row['VocabWord']?></title>
<? include ("../inc/required-links.php") ?>
</head>

<body>
<div id="wrapper">
	<div id="l_l"></div> 
    <div id="left">
		<?php include ('../nav/vocab.php') ?>
    </div>
    <div id="main">
		<?php include ('../inc/header.php') ?>
        <div id="t_bg"></div>
        <div id="content">
			<div class="otstup">
            	<div id="main_left">
            		<h1 style="text-align:center;">Edit Info for: <?=$row['VocabWord']?></h1>
					<div class="corners">
                    	<div class="text">
                            <form class="editForm formPost" method="post" action="edit.php" style="width:420px;">
                            	<div class="modal-header" style="text-align:center;"><h2>Edit: <?=$row['VocabWord']?></h2></div>
                                <br />
                                <div class="control-group">
                                    <label for="VocabWord"><strong>Vocab Word:</strong></label>
                                        <input type="text" name="VocabWord" id="VocabWord" value="<?=$row['VocabWord']?>"
                                        class="required <?=isset($results['VocabWord']) ? 'error' : '' ?>"
                                        style="width:300px;"
                                         />
                                </div>
                                	<br />
                                <div class="control-group">
                                    <label for="Define"><strong>Define:</strong></label><br />
                                        <input type="text" name="Define" id="Define" value="<?=$row['Define']?>"
                                        class="required <?=isset($results['Define']) ? 'error' : '' ?>"
                                        style="width:400px;"
                                         />
                                </div>
                                <div class="control-group modal-footer">
                                   <input type="hidden" name="id" id="id" value="<?=$row['id']?>" />
                                   <input class="btn btn-mini" style="margin-top:10px;" type="submit" value="Update" />
                               	</div>
                            </form>
                            <br /><a href="http://cs.newpaltz.edu<?=$_GET['returnUrl']?>">Cancel</a>
                		</div>
                    </div>
                </div>
                </div>
                <div id="right">
					<?php include ('../inc/cat_box1.php') ?>
					<?php include ('../inc/cat_box3.php') ?>
					<?php include ('../inc/cat_box4.php') ?>
					<?php include ('../inc/sn_links.php') ?>
                </div>
        		<div class="clear"></div>
        	</div>
        </div>
        <div class="clear"></div>  
        <div id="foot">
        	<?php include ('../inc/footer.php') ?>
		</div>
		<?php include ('../inc/copywright.php') ?>
        </div>
<div class="clear"></div> 
</div>
</body>
</html>
<? include ("../inc/required-js.php") ?>
